package study.chapter03.thread;

public class TestThread2 {
    public static void main(String[] args) {
        MyThread2 mt = new MyThread2();
        new Thread(mt, "Thread-A").start();
        new Thread(mt, "Thread-B").start();
        new Thread(mt, "Thread-C").start();
    }
}


//通过实现Runnable实现多线程
class MyThread2 implements Runnable{

    @Override
    public void run() {
        for (int i = 1; i <= 5; i++) {
            System.out.println("线程：" + Thread.currentThread().getName() + "正在执行");
            try {
                Thread.sleep(500);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}



